const sql = require('../../config/request')
//获取role数据
function getRoleSql(){
  return sql('select * from role')
}
//修改role角色状态
function amendRoleStatusSql(arr){
  return sql('update role set roleStatus = ? where id = ?',arr)
}
//搜索角色名称
// 获取search的数据
function getSearchSql(arr) {
  return sql(`select * from role where name like "%\\${arr}%"`);
}
// 删除
function removeRoleSql(arr) {
  return sql(`delete from role where id = ?`,arr);
}
// 添加
function insertRoleSql(arr) {
  return sql(`insert into role values(null,?,?,?,1,?,now())`,arr);
}
//修改
function amendRoleSql(arr) {
  return sql(`update role set name=?,roleIdentification=?,roleRank=?,rolePrivileges=? where id=?`,arr);
}
module.exports = {
  getRoleSql,
  amendRoleStatusSql,
  getSearchSql,
  removeRoleSql,
  insertRoleSql,
  amendRoleSql
}